package com.qsl.sync.server.controller;


import com.qsl.common.result.ResultEntity;
import com.qsl.sync.common.dto.SyncTaskDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 青石路
 */
@RestController
@RequestMapping("/task")
public class SyncTaskController {

    private static final Logger LOG = LoggerFactory.getLogger(SyncTaskController.class);

    @PostMapping("/delete")
    public ResultEntity<String> delete(@RequestBody SyncTaskDTO syncTask) {
        // TODO 删除处理
        LOG.info("删除任务[taskId={}]", syncTask.getTaskId());
        if (syncTask.getClearData()) {
            LOG.info("清空任务[taskId={}]历史数据", syncTask.getTaskId());
            // TODO 清空历史数据
        }
        return ResultEntity.success("删除成功");
    }
}